co = coroutine.create(function ()
print("hi")
end)

print( "co type=",type(co) )
print(co)
-- 挂起状态
print( coroutine.status(co) )
-- 运行协同程序，运行结束则进入终止状态
print( coroutine.resume(co) )
print( coroutine.status(co) )
co = coroutine.create(function (a,b,c)
print("co thread ", a,b,c)
end)
coroutine.resume(co, 1, 2, 3)

co = coroutine.create(function (a,b)
coroutine.yield(a + b, a - b)
end)
print( coroutine.status(co) )
print( coroutine.resume(co,20,30) )
print( coroutine.status(co) )
print( coroutine.resume(co,20,30) )
print( coroutine.status(co) )

co = coroutine.create(function (a, b) print("co", a, b, coroutine.yield()) end)
coroutine.resume(co, 1, 2)        --没输出结果，注意两个数字参数是传递给函数的
coroutine.resume(co, 3, 4, 5,6)        --co 1 2 3 4 5，这里的两个数字参数由resume传递给yield　